﻿
@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<style>
    textarea.form-control {
        padding: 0px 0px;
    }

    .form .formValue textarea.form-control {
        padding-left: 0px;
    }

    .form-control {
        height: 30px;
        line-height: 30px;
        padding: 0px;
        border-radius: 2px;
        width: 96%;
    }
    .btn{
        padding:0px;
    }
</style>
<script>
    var orderId = $.request("orderId");
    var siteSpace = $.request("siteSpace");

    function submitForm() {
        var flowtype = $("#flowtype").val();

        var params = { data: [] };
        $("#newTable tbody tr").each(function () {
            var ntr = $(this);

            var F_SiteId = $($(this)[0].children[0].children[0]).attr('siteid');
            var F_SpaceId = $($(this)[0].children[1].children[0]).attr('spaceid');
            var F_ActivityDate = $(this)[0].children[2].children[0].innerHTML;
            var F_FeeType = $(this)[0].children[3].children[0].value;
            var F_Unit = $(this)[0].children[4].children[0].value;
            var F_SpaceArea = $(this)[0].children[5].children[0].innerHTML;
            var F_MarketPrice = $(this)[0].children[6].children[0].value;
            var F_YunPrice = $(this)[0].children[7].children[0].value;
            var F_SalePrice = $(this)[0].children[8].children[0].value;
            var F_Quantity = $(this)[0].children[9].children[0].value;

            params.data.push({
              
                F_SiteId: F_SiteId,
                F_SpaceId: F_SpaceId,
                F_ActivityDate: F_ActivityDate,
                F_FeeType: F_FeeType,
                F_Unit: F_Unit,
                F_MarketPrice: F_MarketPrice,
                F_YunPrice: F_YunPrice,
                F_SalePrice: F_SalePrice,
                F_SpaceArea: F_SpaceArea,
                F_Quantity: F_Quantity,
            });
        });
        $.submitForm({
            url: "/OrderFlowManage/ClientOrder/SubmitTakeForm",
            param: {
                orderId: orderId,
                siteSpace: siteSpace,
                flowtype: flowtype,
                input: params
            },
            success: function () {
                $.loading(false);
                $.currentWindow().reloadPage(flowtype);
            }
        });
    }


</script>

<script>
    var isCheckPrice = false;
    var checkState = false;

    var resultData = {};
    $(function () {
        getItemList();
        gridList();
        $('#newTable input[type=text]').on("change", function () {
            if (!$(this).val()) {
                $(this).val(0);
            }
        });
        $('#flowtype').change(function () {
            if ($(this).val() == "4" || $(this).val() == "5") {
                $('#bjd').show();
            } else {
                $('#bjd').hide();
            }
        });
    });

    function Clone_Tr(ele,flag) {
        var tr = $(ele).parents('tr.tr').clone();
        var len = $(tr).find('button.del').length;
        if (len==0) {
            $(tr).find('button').append("<button  type='button' class='btn btn-link del' onclick='ClearTr(this)' title='移除'>移除</button>");
        }      
        $('#newTable tbody').append(tr[0].outerHTML);
    }

    function ClearTr(ele) {
        var tr = $(ele).parents('tr.tr');
        tr.detach();
    }

    function getItemList() {
        resultData = getCache("CHECK_ORDERPRICE");
        if (!resultData || resultData.length <= 0) {
            $.ajax({
                url: "/CheckManager/CheckInfos/GetItemsJson",
                dataType: "json",
                async: false,
                success: function (data) {
                    resultData = data;
                    setCache("CHECK_ORDERPRICE", data);
                }, error: function (XMLHttpRequest, textStatus, errorThrown) {

                }
            });
        }
    }

    function Dics(type, value) {
        if (type == "feetype") {
            if (value == "1") {
                return "场地费";
            }
            else if (value == "2") {
                return "搭建费";
            } else if (value == "3") {
                return "安保费";
            } else if (value == "4") {
                return "保洁费";
            } else if (value == "5") {
                return "宽带费";
            } else if (value == "6") {
                return "空调费";
            } else if (value == "7") {
                return "撤场";
            } else if (value == "8") {
                return "电费";
            } else if (value == "9") {
                return "消防";
            } else if (value == "10") {
                return "餐饮费";
            } else if (value == "11") {
                return "加班费";
            } else if (value == "12") {
                return "协助申办服务费";
            }
        } else if (type == "unit") {
            if (value == "1") {
                return "元/天";
            }
            else if (value == "2") {
                return "元/周";
            } else if (value == "3") {
                return "元/月";
            } else if (value == "4") {
                return "元/半天";
            } else if (value == "5") {
                return "元/小时";
            } else if (value == "6") {
                return "㎡/天";
            } else if (value == "7") {
                return "元/场";
            } else if (value == "8") {
                return "元/人";
            } else if (value == "9") {
                return "元/度(电)";
            } else if (value == "10") {
                return "元/m³(水)";
            } else if (value == "11") {
                return "元/个";
            }
        } else if (type == "city") {
            var citys = value.split(',');
            var html = "";
            for (var i = 0; i < resultData.City.length; i++) {
                for (var j = 0; j < citys.length; j++) {
                    if (citys.length == 1) {
                        if (citys[j] == resultData.City[i]["F_EnCode"]) {
                            html += resultData.City[i]["F_FullName"];
                        }
                    } else {
                        if (j == citys.length - 1) {
                            if (citys[j] == resultData.City[i]["F_EnCode"]) {
                                html += resultData.City[i]["F_FullName"];
                            }
                        } else {
                            if (citys[j] == resultData.City[i]["F_EnCode"]) {
                                html += resultData.City[i]["F_FullName"] + ',';
                            }
                        }
                    }
                }
            }
            return html;
        }
    }

    function gridList() {
        $.ajax({
            url: "/OrderFlowManage/ClientOrder/GetCheckPrice",
            dataType: "json",
            async: false,
            data: { siteSpace: siteSpace, orderId: orderId },
            success: function (data) {
                if (data != null) {
                    console.log(data);
                    var siteBS = "";
                    for (var i = 0; i < data.length; i++) {
                        if (i == 0) {
                            $("#F_ActivityTheme").html(data[i]["F_ActivityTheme"]);
                            $("#F_ActivityCityId").html(Dics("city", data[i]["F_ActivityCityId"]));
                            var nrow = "<tr class='tr'>";
                            nrow += "<td><label siteid=\"" + data[i]["F_SiteId"] + "\">" + data[i]["SiteName"] + "</label></td>";
                            nrow += "<td><label spaceid=\"" + data[i]["F_SpaceId"] + "\">" + data[i]["SpaceName"] + "</label></td>";
                            nrow += "<td><label>" + data[i]["F_StartDate"] + "至" + data[i]["F_EndDate"] + "</label></td>";
                            nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\" selected=\"selected\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                            if (data[i]["F_PriceUnit"] == "1" || data[i]["F_PriceUnit"] == null || data[i]["F_PriceUnit"] == "") {
                                nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\" selected=\"selected\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                            } else if (data[i]["F_PriceUnit"] == "1") {
                                nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\" selected=\"selected\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                            } else if (data[i]["F_PriceUnit"] == "5") {
                                nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\" selected=\"selected\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                            } else if (data[i]["F_PriceUnit"] == "2") {
                                nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\" selected=\"selected\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                            } else if (data[i]["F_PriceUnit"] == "3") {
                                nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\" selected=\"selected\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                            } else if (data[i]["F_PriceUnit"] == "4") {
                                nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\" selected=\"selected\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                            } else if (data[i]["F_PriceUnit"] == "6") {
                                nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\" selected=\"selected\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                            } else if (data[i]["F_PriceUnit"] == "7") {
                                nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\" selected=\"selected\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                            } else if (data[i]["F_PriceUnit"] == "8") {
                                nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\" selected=\"selected\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                            } else if (data[i]["F_PriceUnit"] == "9") {
                                nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\" selected=\"selected\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                            } else if (data[i]["F_PriceUnit"] == "10") {
                                nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\" selected=\"selected\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                            } else if (data[i]["F_PriceUnit"] == "11") {
                                nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\" selected=\"selected\">元/个</option></select></td>";
                            }

                            nrow += "<td><label>" + data[i]["F_Area"] + "</label></td>";
                            nrow += "<td><input name=\"F_MarketPrice\" type=\"text\" class=\"form-control number required\" placeholder=\"市场刊例价\" value=\"" + data[i]["F_MarketPrice"] + "\" /></td>";
                            nrow += "<td><input name=\"F_YunPrice\" onchange=\"textChange(this)\" type=\"text\" class=\"form-control number required\" placeholder=\"YUNSPACE价\" value=\"" + data[i]["F_YunPrice"] + "\" /></td>";

                            nrow += "<td><input name=\"F_SalePrice\"  type=\"text\" class=\"form-control number required\" placeholder=\"销售价\" value=\"" + data[i]["F_SalePrice"] + "\" /></td>";

                            nrow += "<td><input name=\"F_Days\" type=\"text\" onchange=\"textChange(this)\" class=\"form-control number\" value=\"" + data[i]["F_Days"] + "\" /></td>";
                            nrow += "<td><input name=\"totalPrice\" onchange=\"TotalPrice(this)\" type=\"text\" class=\"form-control number\" value=\"" + parseFloat(data[i]["F_YunPrice"]) * parseFloat(data[i]["F_Days"]) + "\" /></td>";
                            siteBS = data[i]["F_SpaceId"];
                            nrow += "<td><button  type='button' class='btn btn-link' onclick='Clone_Tr(this,true)' title='添加'>添加</button></td>";
                            //nrow += "<button  type='button' class='btn btn-link' onclick='ClearTr(this)' title='移除'>移除</button></td>";
                            nrow += "</tr>";
                            if (data[i]["F_ServiceCode"] != null) {
                                nrow += "<tr class='tr'>";
                                nrow += "<td><label siteid=\"" + data[i]["F_SiteId"] + "\"></label></td>";
                                nrow += "<td><label spaceid=\"" + data[i]["F_SpaceId"] + "\"></label></td>";
                                nrow += "<td><label></label></td>";
                                if (data[i]["F_ServiceCode"] == "1") {
                                    nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\" selected=\"selected\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                } else if (data[i]["F_ServiceCode"] == "2") {
                                    nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\" selected=\"selected\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                } else if (data[i]["F_ServiceCode"] == "3") {
                                    nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\" selected=\"selected\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                } else if (data[i]["F_ServiceCode"] == "4") {
                                    nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\" selected=\"selected\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                } else if (data[i]["F_ServiceCode"] == "5") {
                                    nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\" selected=\"selected\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                } else if (data[i]["F_ServiceCode"] == "6") {
                                    nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\" >安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\" selected=\"selected\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                } else if (data[i]["F_ServiceCode"] == "7") {
                                    nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\" selected=\"selected\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                } else if (data[i]["F_ServiceCode"] == "8") {
                                    nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\" selected=\"selected\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                } else if (data[i]["F_ServiceCode"] == "9") {
                                    nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\" selected=\"selected\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                } else if (data[i]["F_ServiceCode"] == "10") {
                                    nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\" selected=\"selected\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                } else if (data[i]["F_ServiceCode"] == "11") {
                                    nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\" selected=\"selected\">加班费</option><option value=\"12\" >协助申办服务费</option></select></td>";
                                } else if (data[i]["F_ServiceCode"] == "12") {
                                    nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\" selected=\"selected\">协助申办服务费</option></select></td>";
                                }

                                if (data[i]["F_PriceUnit"] == "1" || data[i]["F_PriceUnit"] == null || data[i]["F_PriceUnit"] == "") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\" selected=\"selected\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "1") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\" selected=\"selected\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "5") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\" selected=\"selected\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "2") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\" selected=\"selected\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "3") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\" selected=\"selected\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "4") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\" selected=\"selected\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "6") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\" selected=\"selected\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "7") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\" selected=\"selected\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "8") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\" selected=\"selected\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "9") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\" selected=\"selected\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "10") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\" selected=\"selected\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "11") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\" selected=\"selected\">元/个</option></select></td>";
                                }

                                if (data[i]["F_ServiceCode"] == "2") {
                                    nrow += "<td><label>" + data[i]["F_Area"] + "</label></td>";
                                    nrow += "<td><input name=\"F_MarketPrice\" type=\"text\" class=\"form-control number required\" placeholder=\"市场刊例价\" value=\"" + data[i]["F_MarketPrice"] + "\" /></td>";
                                    nrow += "<td><input name=\"F_YunPrice\" onchange=\"textChange(this)\" type=\"text\" class=\"form-control number required\" placeholder=\"YUNSPACE价\" value=\"" + data[i]["F_YunPrice"] + "\" /></td>";

                                    nrow += "<td><input name=\"F_Num\" type=\"text\" onchange=\"textChange(this)\" class=\"form-control number\" value=\"" + data[i]["F_Num"] + "\" /></td>";
                                    nrow += "<td><input name=\"totalPrice\" type=\"text\" class=\"form-control\" value=\"" + parseFloat(data[i]["F_YunPrice"]) * parseFloat(data[i]["F_Num"]) + "\" /></td>";
                                } else {
                                    nrow += "<td><label></label></td>";
                                    nrow += "<td><input name=\"F_MarketPrice\" type=\"text\" class=\"form-control number required\" placeholder=\"市场刊例价\" value=\"0\" /></td>";
                                    nrow += "<td><input name=\"F_YunPrice\" onchange=\"textChange(this)\" type=\"text\" class=\"form-control number required\"  value=\"0\" placeholder=\"YUNSPACE价\" /></td>";
                                    nrow += "<td><input name=\"F_Num\" type=\"text\" onchange=\"textChange(this)\" class=\"form-control number\" value=\"" + data[i]["F_Num"] + "\" /></td>";
                                    nrow += "<td><input name=\"totalPrice\" type=\"text\" class=\"form-control number\" value=\"0\" /></td>";
                                }


                                nrow += "</tr>";
                            }

                            $("#newTable").append(nrow);
                        } else {
                            if (siteBS == data[i]["F_SpaceId"]) {
                                if (data[i]["F_ServiceCode"] != null) {
                                    var nrow = "<tr class='tr'>";
                                    nrow += "<td><label siteid=\"" + data[i]["F_SiteId"] + "\"></label></td>";
                                    nrow += "<td><label spaceid=\"" + data[i]["F_SpaceId"] + "\"></label></td>";
                                    nrow += "<td><label></label></td>";
                                    if (data[i]["F_ServiceCode"] == "1") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\" selected=\"selected\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "2") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\" selected=\"selected\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "3") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\" selected=\"selected\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "4") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\" selected=\"selected\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "5") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\" selected=\"selected\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "6") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\" >安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\" selected=\"selected\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "7") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\" selected=\"selected\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "8") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\" selected=\"selected\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "9") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\" selected=\"selected\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "10") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\" selected=\"selected\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "11") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\" selected=\"selected\">加班费</option><option value=\"12\" >协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "12") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\" selected=\"selected\">协助申办服务费</option></select></td>";
                                    }

                                    if (data[i]["F_PriceUnit"] == "1" || data[i]["F_PriceUnit"] == null || data[i]["F_PriceUnit"] == "") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\" selected=\"selected\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "1") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\" selected=\"selected\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "5") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\" selected=\"selected\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "2") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\" selected=\"selected\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "3") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\" selected=\"selected\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "4") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\" selected=\"selected\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "6") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\" selected=\"selected\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "7") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\" selected=\"selected\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "8") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\" selected=\"selected\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "9") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\" selected=\"selected\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "10") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\" selected=\"selected\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "11") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\" selected=\"selected\">元/个</option></select></td>";
                                    }

                                    nrow += "<td><label></label></td>";
                                    nrow += "<td><input name=\"F_MarketPrice\" type=\"text\" class=\"form-control required\" placeholder=\"市场刊例价\" value=\"0\" /></td>";
                                    nrow += "<td><input name=\"F_YunPrice\" onchange=\"textChange(this)\" type=\"text\" class=\"form-control number required\" placeholder=\"YUNSPACE价\" value=\"0\" /></td>";

                                    nrow += "<td><input name=\"F_SalePrice\"  type=\"text\" class=\"form-control number required\" placeholder=\"销售价\" value=\"0\" /></td>";

                                    nrow += "<td><input name=\"F_Num\" type=\"text\" onchange=\"textChange(this)\" class=\"form-control number\" value=\"" + data[i]["F_Num"] + "\" /></td>";
                                    nrow += "<td><input name=\"totalPrice\" type=\"text\" class=\"form-control number\" value=\"0\" /></td>";

                                    nrow += "<td><button  type='button' class='btn btn-link' onclick='Clone_Tr(this,true)' title='添加'>添加</button></td>";
                                   // nrow += "<button  type='button' class='btn btn-link' onclick='ClearTr(this)' title='移除'>移除</button></td>";
                                    nrow += "</tr>";
                                    $("#newTable").append(nrow);
                                }
                            } else {
                                siteBS == data[i]["F_SpaceId"]
                                var nrow = "<tr class='tr'>";
                                nrow += "<td><label siteid=\"" + data[i]["F_SiteId"] + "\">" + data[i]["SiteName"] + "</label></td>";
                                nrow += "<td><label spaceid=\"" + data[i]["F_SpaceId"] + "\">" + data[i]["SpaceName"] + "</label></td>";
                                nrow += "<td><label>" + data[i]["F_StartDate"] + "至" + data[i]["F_EndDate"] + "</label></td>";
                                nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\" selected=\"selected\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                if (data[i]["F_PriceUnit"] == "1" || data[i]["F_PriceUnit"] == null || data[i]["F_PriceUnit"] == "") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\" selected=\"selected\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "1") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\" selected=\"selected\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "5") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\" selected=\"selected\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "2") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\" selected=\"selected\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "3") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\" selected=\"selected\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "4") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\" selected=\"selected\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "6") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\" selected=\"selected\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "7") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\" selected=\"selected\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "8") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\" selected=\"selected\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "9") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\" selected=\"selected\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "10") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\" selected=\"selected\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                } else if (data[i]["F_PriceUnit"] == "11") {
                                    nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\" selected=\"selected\">元/个</option></select></td>";
                                }

                                nrow += "<td><input name=\"F_Area\" type=\"text\" class=\"form-control number\" value=\"" + data[i]["F_Area"] + "\"/></td>";
                                nrow += "<td><input name=\"F_MarketPrice\" type=\"text\" class=\"form-control number required\" placeholder=\"市场刊例价\" value=\"" + data[i]["F_MarketPrice"] + "\" /></td>";
                                nrow += "<td><input name=\"F_YunPrice\" onchange=\"textChange(this)\" type=\"text\" class=\"form-control number required\" placeholder=\"YUNSPACE价\" value=\"" + data[i]["F_YunPrice"] + "\" /></td>";

                                nrow += "<td><input name=\"F_SalePrice\"  type=\"text\" class=\"form-control number required\" placeholder=\"销售价\" value=\"" + data[i]["F_SalePrice"] + "\" /></td>";

                                nrow += "<td><input name=\"F_Days\" type=\"text\" onchange=\"textChange(this)\" class=\"form-control number\" value=\"" + data[i]["F_Days"] + "\" /></td>";
                                nrow += "<td><input name=\"totalPrice\" type=\"text\" class=\"form-control number\" value=\"" + parseFloat(data[i]["F_YunPrice"]) * parseFloat(data[i]["F_Days"]) + "\" /></td>";
                                siteBS = data[i]["F_SpaceId"];
                                nrow += "<td><button  type='button' class='btn btn-link' onclick='Clone_Tr(this,true)' title='添加'>添加</button></td>";
                                //nrow += "<button  type='button' class='btn btn-link' onclick='ClearTr(this)' title='移除'>移除</button></td>";
                                nrow += "</tr>";
                                if (data[i]["F_ServiceCode"] != null) {
                                    nrow += "<tr class='tr'>";
                                    nrow += "<td><label siteid=\"" + data[i]["F_SiteId"] + "\"></label></td>";
                                    nrow += "<td><label spaceid=\"" + data[i]["F_SpaceId"] + "\"></label></td>";
                                    nrow += "<td><label></label></td>";
                                    if (data[i]["F_ServiceCode"] == "1") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\" selected=\"selected\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "2") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\" selected=\"selected\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "3") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\" selected=\"selected\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "4") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\" selected=\"selected\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "5") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\" selected=\"selected\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "6") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\" >安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\" selected=\"selected\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "7") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\" selected=\"selected\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "8") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\" selected=\"selected\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "9") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\" selected=\"selected\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "10") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\" selected=\"selected\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\">协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "11") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\" selected=\"selected\">加班费</option><option value=\"12\" >协助申办服务费</option></select></td>";
                                    } else if (data[i]["F_ServiceCode"] == "12") {
                                        nrow += "<td><select name=\"F_FeeType\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"1\">场地费</option><option value=\"2\">搭建费</option><option value=\"3\">安保费</option><option value=\"4\">保洁费</option><option value=\"5\">宽带费</option><option value=\"6\">空调费</option><option value=\"7\">撤场</option><option value=\"8\">电费</option><option value=\"9\">消防</option><option value=\"10\">餐饮费</option><option value=\"11\">加班费</option><option value=\"12\" selected=\"selected\">协助申办服务费</option></select></td>";
                                    }


                                    if (data[i]["F_PriceUnit"] == "1" || data[i]["F_PriceUnit"] == null || data[i]["F_PriceUnit"] == "") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\" selected=\"selected\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "1") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\" selected=\"selected\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "5") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\" selected=\"selected\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "2") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\" selected=\"selected\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "3") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\" selected=\"selected\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "4") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\" selected=\"selected\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "6") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\" selected=\"selected\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "7") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\" selected=\"selected\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "8") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\" selected=\"selected\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "9") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\" selected=\"selected\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "10") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\" selected=\"selected\">元/m³(水)</option><option value=\"11\">元/个</option></select></td>";
                                    } else if (data[i]["F_PriceUnit"] == "11") {
                                        nrow += "<td><select name=\"F_Units\" class=\"form-control required\"><option value=\"\">请选择</option><option value=\"7\">元/场</option><option value=\"1\">元/天</option><option value=\"5\">元/小时</option><option value=\"2\">元/周</option><option value=\"3\">元/月</option><option value=\"4\">元/半天</option><option value=\"6\">㎡/天</option><option value=\"8\">元/人</option><option value=\"9\">元/度(电)</option><option value=\"10\">元/m³(水)</option><option value=\"11\" selected=\"selected\">元/个</option></select></td>";
                                    }

                                    nrow += "<td><label></label></td>";
                                    nrow += "<td><input name=\"F_MarketPrice\" type=\"text\" class=\"form-control required number\" placeholder=\"市场刊例价\" value=\"0\" /></td>";
                                    nrow += "<td><input name=\"F_YunPrice\" onchange=\"textChange(this)\" type=\"text\" class=\"form-control required number\" placeholder=\"YUNSPACE价\" value=\"0\" /></td>";
                                    nrow += "<td><input name=\"F_SalePrice\"  type=\"text\" class=\"form-control number required\" placeholder=\"销售价\" value=\"0\" /></td>";

                                    nrow += "<td><input name=\"F_Num\" type=\"text\" onchange=\"textChange(this)\" class=\"form-control number\" value=\"" + data[i]["F_Num"] + "\" /></td>";
                                    nrow += "<td><input name=\"totalPrice\" type=\"text\" class=\"form-control number\" value=\"0\" /></td>";


                                    nrow += "</tr>";
                                }
                                $("#newTable").append(nrow);
                            }
                        }
                    }
                    TotalPrice();
                }
            }, error: function (XMLHttpRequest, textStatus, errorThrown) {

            }
        });
    }

    function textChange(obj) {
        var newRow = $(obj).parent().parent();
        if (!newRow[0].cells[7].children[0].value) {
            newRow[0].cells[7].children[0].value = 0;
        }
        if (!newRow[0].cells[9].children[0].value) {
            newRow[0].cells[9].children[0].value = 0;
        }
        newRow[0].cells[10].children[0].value = parseFloat(newRow[0].cells[7].children[0].value) * parseInt(newRow[0].cells[9].children[0].value);
        TotalPrice();
    }

    function TotalPrice() {
        var count = 0;
        var marketprice = 0;
        var yunprice = 0;
        $("#newTable tbody tr").each(function () {
            var ntr = $(this);
            count += parseFloat(ntr[0].children[10].children[0].value);
        });
        $("#sp_totalPrice").html(count);
    }

  
</script>
<form id="form1">
    <div style="padding-top: 20px; margin-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle">步骤名称</th>
                <td class="formValue">
                    <select id="flowtype" class="form-control" style="width:200px">
                        <option value="2">带看场地</option>
                        <option value="3">意向场地报价</option>
                        <option value="4">价格审核</option>
                        <option value="5">场地预定</option>
                        <option value="6">用印申请</option>
                    </select>
                </td>
            </tr>
            <tr>
               
            </tr>
            <tr>
                <th class="formTitle" colspan="2">
                    <div id="bjd" style="display:none;">
                        <p style="text-align:center;">添加报价单</p>
                        <table class="form ui-jqgrid-htable ui-common-table table table-bordered" id="newTable">
                            <thead>
                                <tr class="ui-jqgrid-labels">
                                    <th class="ui-th-column ui-th-ltr">场地名称</th>
                                    <th class="ui-th-column ui-th-ltr">使用空间</th>
                                    <th class="ui-th-column ui-th-ltr">活动档期</th>
                                    <th class="ui-th-column ui-th-ltr" style="width:80px;">费用类品</th>
                                    <th class="ui-th-column ui-th-ltr" style="width:60px;">单位</th>
                                    <th class="ui-th-column ui-th-ltr" style="width:80px;">使用面积(㎡)</th>
                                    <th class="ui-th-column ui-th-ltr" style="width:100px;">市场刊例价(元)</th>
                                    <th class="ui-th-column ui-th-ltr" style="width:100px;">YUNSPACE底价(元)</th>
                                    <th class="ui-th-column ui-th-ltr" style="width:100px;">销售价(元)</th>
                                    <th class="ui-th-column ui-th-ltr" style="width:40px;">数量</th>
                                    <th class="ui-th-column ui-th-ltr" style="width:80px;">合计价格(元)</th>
                                    <th class="ui-th-column ui-th-ltr" style="width:80px;">操作</th>
                                </tr>
                            </thead>
                            <tbody></tbody>
                            <tfoot>
                                <tr>
                                    <td colspan="11"><span style="float:right;font-weight:bold;">合计价</span></td>
                                    <td><span id="sp_totalPrice" style="color:#D9534F"></span></td>
                                </tr>
                            </tfoot>
                        </table>
                    </div>
                </th>
            </tr>
        </table>
    </div>
</form>
